package com.lalilu.homework3.fragment;

import android.app.Dialog;
import android.os.Bundle;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;

import java.util.Objects;

public class SimpleDialogFragment extends DialogFragment {
    public static String TAG = SimpleDialogFragment.class.getName();


    @NonNull
    @Override
    public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
        return new AlertDialog.Builder(Objects.requireNonNull(getContext()))
                .setTitle("新版对话框")
                .setMessage("新版对话框，推荐使用这种方式，支持屏幕选择！")
                .setPositiveButton("确定", (dialog, which) -> Log.i(TAG, "点击了确定"))
                .setNegativeButton("取消", (dialog, which) -> Log.i(TAG, "点击了取消"))
                .create();
    }

}
